/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Cripto;

/**
 *
 * @author Dan dotcom
 */
public class AEMD {
    
    public static String MD5Cipher;
    public static String AESCipher;
    public static String key1;
    public static String key2;
    public static String fkey;

    public String AEMD(String cadena) throws Exception {
        
        MD5 _md5 = new MD5();
        AES _aes = new AES();
        

        
        MD5Cipher = _md5.getMD5(cadena);
        
        key1 = (MD5Cipher.substring(16, 32));
        System.out.println(key1.length());
        
        byte[] cifrado = _aes.encriptar(key1, key1);
        
        for (int i=0; i<cifrado.length; i++)
        AESCipher += (new Integer(cifrado[i]));
        
        key2 = AESCipher + key1;
        
        fkey = _md5.getMD5(key2) + key1;
        
        System.out.println(fkey);
        
        return fkey;
    }
    
}
